package com.ruoyi.his.service.impl;



import com.ruoyi.his.domain.HisTitle;
import com.ruoyi.his.mapper.HisTitleMapper;
import com.ruoyi.his.service.HisTitleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HisTitleServiceImpl implements HisTitleService {

    @Autowired
    private HisTitleMapper hisTitleMapper;
    @Override
    public HisTitle getTitleInfo(HisTitle title) {
        return hisTitleMapper.getTitleInfo(title);
    }

    @Override
    public int changeRegisterTitle(HisTitle hisTitle) {
        hisTitle.setTagee("2");
        HisTitle his = new HisTitle();
        if(hisTitle.getSignature() !=null && hisTitle.getSignature() != ""){
        his.setSignature(hisTitle.getSignature());
            HisTitle u = hisTitleMapper.getTitleInfo(his);
            if (u != null) {
                return hisTitleMapper.changeRegisterTitle(hisTitle);
            }else {
                return hisTitleMapper.insertTitle(hisTitle);
            }
        }
        return 0;
    }
    @Override
    public int changeLoginTitle(HisTitle hisTitle) {
        return hisTitleMapper.changeLoginTitle(hisTitle);
    }
}

